<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.3"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FabGL: VGA/SoundChipSimulator/SoundChipSimulator.ino</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">FabGL
   </div>
   <div id="projectbrief">ESP32 Display Controller and Graphics Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.3 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('_v_g_a_2_sound_chip_simulator_2_sound_chip_simulator_8ino-example.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle"><div class="title">VGA/SoundChipSimulator/SoundChipSimulator.ino</div></div>
</div><!--header-->
<div class="contents">
<p >Sound chip simulator, from Carles Oriol</p>
<div class="fragment"><div class="line"><span class="preprocessor">#if CONFIG_FREERTOS_UNICORE</span></div>
<div class="line"><span class="preprocessor">#define ARDUINO_RUNNING_CORE 0</span></div>
<div class="line"><span class="preprocessor">#else</span></div>
<div class="line"><span class="preprocessor">#define ARDUINO_RUNNING_CORE 1</span></div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#define PLAY_SOUND_PRIORITY 3</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="fabgl_8h.html">fabgl.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><a id="_a0" name="_a0"></a><a class="code hl_class" href="classfabgl_1_1_v_g_a16_controller.html">fabgl::VGA16Controller</a> VGAController;</div>
<div class="line"><a id="_a1" name="_a1"></a><a class="code hl_class" href="classfabgl_1_1_canvas.html">fabgl::Canvas</a>        canvas(&amp;VGAController);</div>
<div class="line"><a id="_a2" name="_a2"></a><a class="code hl_class" href="classfabgl_1_1_p_s2_controller.html">fabgl::PS2Controller</a> PS2Controller;</div>
<div class="line">SoundGenerator       soundGenerator;</div>
<div class="line"><a id="_a3" name="_a3"></a><a class="code hl_class" href="classfabgl_1_1_terminal.html">fabgl::Terminal</a>      Terminal;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">enum</span> wavetype { WAVE_SQUARE, WAVE_SINE, WAVE_TRIANGLE, WAVE_SAW, WAVE_NOISE };</div>
<div class="line"><span class="keyword">enum</span> modfreqmode { MODFREQ_NONE, MODFREQ_TO_END, MODFREQ_TO_RELEASE, MODFREQ_TO_SUSTAIN  };</div>
<div class="line"> </div>
<div class="line"><span class="keyword">struct </span>playsounddata</div>
<div class="line">{</div>
<div class="line">  <span class="keywordtype">long</span> attack; <span class="comment">// time in millis (for now)</span></div>
<div class="line">  <span class="keywordtype">long</span> decay; <span class="comment">// time in millis (for now)</span></div>
<div class="line">  <span class="keywordtype">int</span> sustain; <span class="comment">// 0-127 range (over volume)</span></div>
<div class="line">  <span class="keywordtype">long</span> release; <span class="comment">// time in millis (for now)</span></div>
<div class="line"> </div>
<div class="line">  wavetype wave; <span class="comment">// square, sine, triangle, saw, noise</span></div>
<div class="line">  <span class="keywordtype">int</span> volume;</div>
<div class="line">  <span class="keywordtype">int</span> durationms;</div>
<div class="line">  <span class="keywordtype">int</span> freq_start;</div>
<div class="line">  <span class="keywordtype">int</span> freq_end;</div>
<div class="line">  modfreqmode modfreq;</div>
<div class="line"> </div>
<div class="line">};</div>
<div class="line"> </div>
<div class="line">SquareWaveformGenerator swg;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> setup() {</div>
<div class="line"> </div>
<div class="line">  Serial.<a id="a4" name="a4"></a><a class="code hl_function" href="classfabgl_1_1_terminal_aebaecc1fa474fddc48dd5778024b19a5.html#aebaecc1fa474fddc48dd5778024b19a5">begin</a>(115200);</div>
<div class="line">  PS2Controller.<a id="a5" name="a5"></a><a class="code hl_function" href="classfabgl_1_1_p_s2_controller_ab8520612804a921ad834b41214a99c09.html#ab8520612804a921ad834b41214a99c09">begin</a>(PS2Preset::KeyboardPort0); <span class="comment">//, KbdMode::GenerateVirtualKeys)</span></div>
<div class="line"> </div>
<div class="line">  VGAController.begin();</div>
<div class="line">  VGAController.<a id="a6" name="a6"></a>setResolution(<a id="a7" name="a7"></a><a class="code hl_define" href="fabglconf_8h_a86b59f35df218823a6165d836cfc22c0.html#a86b59f35df218823a6165d836cfc22c0">VGA_640x400_70Hz</a>);</div>
<div class="line">  VGAController.moveScreen(5, 0);</div>
<div class="line"> </div>
<div class="line">  soundGenerator.setVolume(126);</div>
<div class="line">  soundGenerator.play(<span class="keyword">true</span>);</div>
<div class="line">  soundGenerator.attach( &amp;swg);</div>
<div class="line"> </div>
<div class="line">  Terminal.<a class="code hl_function" href="classfabgl_1_1_terminal_aebaecc1fa474fddc48dd5778024b19a5.html#aebaecc1fa474fddc48dd5778024b19a5">begin</a>(&amp;VGAController);</div>
<div class="line">  Terminal.<a id="a8" name="a8"></a><a class="code hl_function" href="classfabgl_1_1_terminal_a068123b964647130439aa949370181dc.html#a068123b964647130439aa949370181dc">connectLocally</a>();</div>
<div class="line">  Terminal.<a id="a9" name="a9"></a><a class="code hl_function" href="classfabgl_1_1_terminal_a2da678d7453efcfed190b99ac93a53d0.html#a2da678d7453efcfed190b99ac93a53d0">clear</a>();</div>
<div class="line">  Terminal.<a id="a10" name="a10"></a><a class="code hl_function" href="classfabgl_1_1_terminal_aace245bfe6cab7b4339bd691077e1c23.html#aace245bfe6cab7b4339bd691077e1c23">enableCursor</a>(<span class="keyword">true</span>);</div>
<div class="line"> </div>
<div class="line">  Terminal.<a id="a11" name="a11"></a><a class="code hl_function" href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">write</a>( <span class="stringliteral">&quot;SoundChip simulator by Carles Oriol 2020\r\n\r\n&quot;</span>);</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> iPlaySound( <span class="keywordtype">void</span> *pvParameters )</div>
<div class="line">{</div>
<div class="line">  playsounddata psd = *(playsounddata *)pvParameters;</div>
<div class="line"> </div>
<div class="line">  WaveformGenerator *pwave;</div>
<div class="line">  <span class="keywordflow">if</span> ( psd.wave == WAVE_SQUARE)   pwave = <span class="keyword">new</span> SquareWaveformGenerator();</div>
<div class="line">  <span class="keywordflow">if</span> ( psd.wave == WAVE_SINE)     pwave = <span class="keyword">new</span> SineWaveformGenerator();</div>
<div class="line">  <span class="keywordflow">if</span> ( psd.wave == WAVE_TRIANGLE) pwave = <span class="keyword">new</span> TriangleWaveformGenerator();</div>
<div class="line">  <span class="keywordflow">if</span> ( psd.wave == WAVE_SAW)      pwave = <span class="keyword">new</span> SawtoothWaveformGenerator();</div>
<div class="line">  <span class="keywordflow">if</span> ( psd.wave == WAVE_NOISE)    pwave = <span class="keyword">new</span> NoiseWaveformGenerator();</div>
<div class="line"> </div>
<div class="line">  <span class="keywordtype">int</span> sustainVolume = psd.sustain * psd.volume / 127;</div>
<div class="line"> </div>
<div class="line">  soundGenerator.attach( pwave);</div>
<div class="line">  pwave-&gt;setVolume( ((psd.attack == 0) ? ( (psd.decay != 0) ? psd.volume : sustainVolume) : 0) );</div>
<div class="line">  pwave-&gt;setFrequency( psd.freq_start );</div>
<div class="line">  pwave-&gt;enable(<span class="keyword">true</span> );</div>
<div class="line"> </div>
<div class="line">  <span class="keywordtype">long</span> startTime = millis();</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">while</span> ( millis() - startTime &lt; psd.durationms)</div>
<div class="line">  {</div>
<div class="line">    <span class="keywordtype">long</span> current = millis() - startTime;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">if</span> ( current &lt; psd.attack ) <span class="comment">// ATTACK VOLUME</span></div>
<div class="line">      pwave-&gt;setVolume( (psd.volume * current) / psd.attack );</div>
<div class="line">    <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( current &gt; psd.attack &amp;&amp; current &lt; (psd.attack + psd.decay)) <span class="comment">// DECAY VOLUME</span></div>
<div class="line">      pwave-&gt;setVolume( map( current - psd.attack,  0, psd.decay,  psd.volume, sustainVolume ) );</div>
<div class="line">    <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( current &gt; psd.durationms - psd.release) <span class="comment">// RELEASE VOLUME</span></div>
<div class="line">      pwave-&gt;setVolume( map( current - (psd.durationms - psd.release),  0, psd.release,  sustainVolume, 0 ) );</div>
<div class="line">    <span class="keywordflow">else</span></div>
<div class="line">      pwave-&gt;setVolume( sustainVolume );</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">if</span> ( psd.modfreq != MODFREQ_NONE)</div>
<div class="line">    {</div>
<div class="line">      <span class="keywordtype">int</span> maxtime = psd.durationms;</div>
<div class="line">      <span class="keywordflow">if</span>      (psd.modfreq == MODFREQ_TO_RELEASE)</div>
<div class="line">        maxtime = (psd.durationms - psd.release); <span class="comment">// until release</span></div>
<div class="line">      <span class="keywordflow">else</span> <span class="keywordflow">if</span> (psd.modfreq == MODFREQ_TO_SUSTAIN)</div>
<div class="line">        maxtime = (psd.attack + psd.decay); <span class="comment">// until sustain</span></div>
<div class="line"> </div>
<div class="line">      <span class="keywordtype">int</span> f = ((current &gt; maxtime) ? psd.freq_end : (map(current, 0, maxtime, psd.freq_start, psd.freq_end)));</div>
<div class="line">      pwave-&gt;setFrequency ( f ) ;</div>
<div class="line">    }</div>
<div class="line">    vTaskDelay(1);</div>
<div class="line">  }</div>
<div class="line"> </div>
<div class="line">  soundGenerator.detach( pwave);</div>
<div class="line">  pwave-&gt;enable( <span class="keyword">false</span> );</div>
<div class="line">  <span class="keyword">delete</span> pwave;</div>
<div class="line"> </div>
<div class="line">  vTaskDelete( NULL );</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> playSound( playsounddata ps )</div>
<div class="line">{</div>
<div class="line">  <span class="comment">// Now set up two tasks to run independently.</span></div>
<div class="line">  xTaskCreatePinnedToCore( iPlaySound,  <span class="stringliteral">&quot;iPlaySound&quot;</span>,</div>
<div class="line">                           4096,  <span class="comment">// This stack size can be checked &amp; adjusted by reading the Stack Highwater</span></div>
<div class="line">                           &amp;ps, <span class="comment">// sound as parameters</span></div>
<div class="line">                           PLAY_SOUND_PRIORITY,  <span class="comment">// Priority, with 3 (configMAX_PRIORITIES - 1) being the highest, and 0 being the lowest.</span></div>
<div class="line">                           NULL,</div>
<div class="line">                           ARDUINO_RUNNING_CORE);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span>  syncPlaySound( playsounddata psd)</div>
<div class="line">{</div>
<div class="line">  playSound( psd);</div>
<div class="line">  delay(psd.durationms);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> loop() {</div>
<div class="line"> </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;shot&quot;</span> );</div>
<div class="line">      syncPlaySound ( {0, 0, 127, 64, WAVE_NOISE, 127, 64, 120, 0, MODFREQ_NONE} );</div>
<div class="line">      delay(2000);</div>
<div class="line">    </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;boom&quot;</span> );</div>
<div class="line">      syncPlaySound ( {5, 128, 120, 256, WAVE_NOISE, 127, 512, 1, 1, MODFREQ_NONE} );</div>
<div class="line">      delay(2000);</div>
<div class="line">    </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;pong&quot;</span> );</div>
<div class="line">      syncPlaySound ( {0, 1, 127, 8, WAVE_SQUARE, 127, 21, 392, 0, MODFREQ_NONE} );</div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;pic&quot;</span> );</div>
<div class="line">      syncPlaySound ( {2, 1, 127, 3, WAVE_SQUARE, 127, 12, 977, 0, MODFREQ_NONE} );</div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;tuc&quot;</span> );</div>
<div class="line">      syncPlaySound ( {5, 0, 127, 39, WAVE_TRIANGLE, 127, 44, 352, 275, MODFREQ_TO_END} );</div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;piu&quot;</span> );</div>
<div class="line">      syncPlaySound (  {5, 0, 127, 39, WAVE_TRIANGLE, 127, 154, 1200, 440, MODFREQ_TO_END} );</div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;fiu fiu whistle&quot;</span> );</div>
<div class="line">      syncPlaySound ({100, 0, 127, 20, WAVE_SQUARE, 127, 356, 220, 3000, MODFREQ_TO_END} );    </div>
<div class="line">      delay(64);</div>
<div class="line">      syncPlaySound ({100, 0, 127, 20, WAVE_SQUARE, 100, 256, 220, 3000, MODFREQ_TO_END});</div>
<div class="line">      syncPlaySound ({32, 32, 100, 512 - 64, WAVE_SQUARE, 100, 512, 4400, 220, MODFREQ_TO_END});    </div>
<div class="line">      delay(2000);</div>
<div class="line"> </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;fiu fiu serpentina&quot;</span> );</div>
<div class="line">      syncPlaySound ({100, 0, 127, 20, WAVE_SAW, 127, 356, 220, 3000, MODFREQ_TO_END} );</div>
<div class="line">      delay(64);</div>
<div class="line">      syncPlaySound ({100, 0, 127, 20, WAVE_SAW, 100, 256, 220, 3000, MODFREQ_TO_END});</div>
<div class="line">      syncPlaySound ({32, 32, 100, 512 - 64, WAVE_SAW, 100, 512, 4400, 220, MODFREQ_TO_END});</div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;motor&quot;</span> );</div>
<div class="line">      syncPlaySound ( {100, 0, 127, 20, WAVE_SAW, 100, 2048, 0, 120, MODFREQ_TO_END});    </div>
<div class="line">      syncPlaySound ( {100, 0, 127, 20, WAVE_SAW, 127, 2048, 100, 220, MODFREQ_TO_END});    </div>
<div class="line">      syncPlaySound ( {100, 0, 127, 20, WAVE_SAW, 127, 2048, 180, 250, MODFREQ_TO_END});    </div>
<div class="line">      syncPlaySound ( {100, 0, 127, 20, WAVE_SAW, 127, 2048, 220, 280, MODFREQ_TO_END});    </div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;escala&quot;</span> );</div>
<div class="line">      <span class="keywordtype">int</span> escala[] = { 262,  294,  330,  349,  392,  440,  494, 523   };</div>
<div class="line">      <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> ncompta = 0; ncompta &lt; 8; ncompta++)    </div>
<div class="line">        syncPlaySound ( {10, 5, 100, 10, WAVE_SINE, 127, 1000, (int)escala[ncompta], 0, MODFREQ_NONE} );          </div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;escala_inc&quot;</span> );</div>
<div class="line">      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> freqmode = MODFREQ_TO_END; freqmode &lt;= MODFREQ_TO_SUSTAIN; freqmode++)</div>
<div class="line">        <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> ncompta = 0; ncompta &lt; 8; ncompta++)</div>
<div class="line">          syncPlaySound ( {50, 50, 100, 250, WAVE_SINE, 127, 1000, escala[ncompta], (escala[ncompta] * 2), (modfreqmode)freqmode} );              </div>
<div class="line">      delay(2000);</div>
<div class="line"> </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;escalax&quot;</span> );    </div>
<div class="line">      <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> nc = 0; nc &lt; 4; nc++)</div>
<div class="line">      {</div>
<div class="line">        <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> ncompta = 0; ncompta &lt; 8; ncompta++)      </div>
<div class="line">          syncPlaySound ( {2, 2, 50, 10, WAVE_SINE, 64, 64, (int)escala[ncompta], 0, MODFREQ_NONE} );        </div>
<div class="line">        <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> ncompta = 0; ncompta &lt; 8; ncompta++)</div>
<div class="line">          syncPlaySound ( {2, 2, 50, 10, WAVE_TRIANGLE, 127, 64, (int)escala[ncompta], 0, MODFREQ_NONE} );      </div>
<div class="line">      }</div>
<div class="line">  </div>
<div class="line">      delay(2000);</div>
<div class="line">    </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;chord&quot;</span> );</div>
<div class="line">      syncPlaySound (  {10, 30, 90, 50, WAVE_SINE, 127, 1000, 262, 0, MODFREQ_NONE} );    </div>
<div class="line">      syncPlaySound (  {10, 30, 90, 50, WAVE_SINE, 127, 1000, 330, 0, MODFREQ_NONE} );    </div>
<div class="line">      syncPlaySound (  {10, 30, 90, 50, WAVE_SINE, 127, 1000, 392, 0, MODFREQ_NONE} );    </div>
<div class="line">      syncPlaySound (  {10, 30, 90, 50, WAVE_SINE, 127, 1000, 523, 0, MODFREQ_NONE} );    </div>
<div class="line">  </div>
<div class="line">      delay ( 2000 );</div>
<div class="line">  </div>
<div class="line">      playSound (  {10, 30, 90, 50, WAVE_SINE, 127, 4000, 262, 0, MODFREQ_NONE} );</div>
<div class="line">      delay(1000);</div>
<div class="line">      playSound (  {10, 30, 90, 50, WAVE_SINE, 127, 3000, 330, 0, MODFREQ_NONE} );</div>
<div class="line">      delay(1000);</div>
<div class="line">      playSound (  {10, 30, 90, 50, WAVE_SINE, 127, 2000, 392, 0, MODFREQ_NONE} );</div>
<div class="line">      delay(1000);</div>
<div class="line">      playSound (  {10, 30, 90, 50, WAVE_SINE, 127, 1000, 523, 0, MODFREQ_NONE} );</div>
<div class="line">      delay(1000);</div>
<div class="line">  </div>
<div class="line">      delay ( 2000 );</div>
<div class="line">  </div>
<div class="line">      playSound (  {1, 30, 90, 50, WAVE_SINE, 127, 2000, 262, 0, MODFREQ_NONE} );</div>
<div class="line">      delay(25);</div>
<div class="line">      playSound (  {1, 30, 90, 50, WAVE_SINE, 127, 1975, 330, 0, MODFREQ_NONE} );</div>
<div class="line">      delay(25);</div>
<div class="line">      playSound (  {1, 30, 90, 50, WAVE_SINE, 127, 1950, 392, 0, MODFREQ_NONE} );</div>
<div class="line">      delay(25);</div>
<div class="line">      playSound (  {1, 30, 90, 50, WAVE_SINE, 127, 1925, 523, 0, MODFREQ_NONE} );</div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">      playSound (  {100, 30, 90, 50, WAVE_SINE, 127, 2000, 262, 0, MODFREQ_NONE} );</div>
<div class="line">      playSound (  {100, 30, 90, 50, WAVE_SINE, 127, 2000, 311, 0, MODFREQ_NONE} );</div>
<div class="line">      playSound (  {100, 30, 90, 50, WAVE_SINE, 127, 2000, 392, 0, MODFREQ_NONE} );</div>
<div class="line">  </div>
<div class="line">      <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> compta = 0; compta &lt; 5; compta++)</div>
<div class="line">      {</div>
<div class="line">        syncPlaySound (  {100, 30, 90, 50, WAVE_SINE, 127, 200, 494, 0, MODFREQ_NONE} );      </div>
<div class="line">        syncPlaySound (  {100, 30, 90, 50, WAVE_SINE, 127, 200, 523, 0, MODFREQ_NONE} );      </div>
<div class="line">      }</div>
<div class="line">      </div>
<div class="line">      delay ( 2000 );</div>
<div class="line"> </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;crossed&quot;</span> );</div>
<div class="line">      playSound ({100, 0, 127, 100, WAVE_SINE, 127, 2000, 100, 4000, MODFREQ_TO_END} );</div>
<div class="line">      playSound ({100, 0, 127, 100, WAVE_SINE, 127, 2000, 4000, 100, MODFREQ_TO_END} );</div>
<div class="line">      delay(2000);</div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">      <span class="keywordflow">for</span>( <span class="keywordtype">int</span> ncompta = 0; ncompta &lt; 5; ncompta++)</div>
<div class="line">      {</div>
<div class="line">        playSound ({100, 0, 127, 100, WAVE_SQUARE, 127, 2000, 100, 4000, MODFREQ_TO_END} );    </div>
<div class="line">        delay(150);</div>
<div class="line">      }</div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">  </div>
<div class="line">      <span class="keywordflow">for</span>( <span class="keywordtype">int</span> ncompta = 0; ncompta &lt; 5; ncompta++)</div>
<div class="line">      {</div>
<div class="line">        playSound ({100, 0, 127, 100, WAVE_SQUARE, 127, 2000, 100, 4000, MODFREQ_TO_END} );</div>
<div class="line">        playSound ({100, 0, 127, 100, WAVE_SQUARE, 127, 2000, 4000, 100, MODFREQ_TO_END} );</div>
<div class="line">        delay(100);</div>
<div class="line">      }</div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">      delay(2000);</div>
<div class="line">    </div>
<div class="line"> </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;Random frequencies mixed&quot;</span> );</div>
<div class="line">      <span class="keywordflow">for</span>( <span class="keywordtype">int</span> ncompta = 0; ncompta &lt; 30; ncompta++)</div>
<div class="line">      {</div>
<div class="line">        playSound ({100, 0, 127, 100, WAVE_SQUARE, 127, 2000, random(20,2000), random(20,2000), MODFREQ_TO_END} );    </div>
<div class="line">        delay(250);</div>
<div class="line">      }</div>
<div class="line">      delay(2000);</div>
<div class="line">  </div>
<div class="line">    Terminal.println( <span class="stringliteral">&quot;That&#39;s all folks...&quot;</span> );</div>
<div class="line">}</div>
<div class="ttc" id="aclassfabgl_1_1_canvas_html"><div class="ttname"><a href="classfabgl_1_1_canvas.html">fabgl::Canvas</a></div><div class="ttdoc">A class with a set of drawing methods.</div><div class="ttdef"><b>Definition:</b> <a href="canvas_8h_source.html#l00070">canvas.h:70</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_p_s2_controller_ab8520612804a921ad834b41214a99c09_html_ab8520612804a921ad834b41214a99c09"><div class="ttname"><a href="classfabgl_1_1_p_s2_controller_ab8520612804a921ad834b41214a99c09.html#ab8520612804a921ad834b41214a99c09">fabgl::PS2Controller::begin</a></div><div class="ttdeci">static void begin(gpio_num_t port0_clkGPIO, gpio_num_t port0_datGPIO, gpio_num_t port1_clkGPIO=GPIO_UNUSED, gpio_num_t port1_datGPIO=GPIO_UNUSED)</div><div class="ttdoc">Initializes PS2 device controller.</div><div class="ttdef"><b>Definition:</b> <a href="ps2controller_8cpp_source.html#l01115">ps2controller.cpp:1115</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_p_s2_controller_html"><div class="ttname"><a href="classfabgl_1_1_p_s2_controller.html">fabgl::PS2Controller</a></div><div class="ttdoc">The PS2 device controller class.</div><div class="ttdef"><b>Definition:</b> <a href="ps2controller_8h_source.html#l00082">ps2controller.h:82</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_a068123b964647130439aa949370181dc_html_a068123b964647130439aa949370181dc"><div class="ttname"><a href="classfabgl_1_1_terminal_a068123b964647130439aa949370181dc.html#a068123b964647130439aa949370181dc">fabgl::Terminal::connectLocally</a></div><div class="ttdeci">void connectLocally()</div><div class="ttdoc">Permits using of terminal locally.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l00439">terminal.cpp:439</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_a2da678d7453efcfed190b99ac93a53d0_html_a2da678d7453efcfed190b99ac93a53d0"><div class="ttname"><a href="classfabgl_1_1_terminal_a2da678d7453efcfed190b99ac93a53d0.html#a2da678d7453efcfed190b99ac93a53d0">fabgl::Terminal::clear</a></div><div class="ttdeci">void clear(bool moveCursor=true)</div><div class="ttdoc">Clears the screen.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l00797">terminal.cpp:797</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7_html_a7c66fc8d559f4956d4ccea196299bca7"><div class="ttname"><a href="classfabgl_1_1_terminal_a7c66fc8d559f4956d4ccea196299bca7.html#a7c66fc8d559f4956d4ccea196299bca7">fabgl::Terminal::write</a></div><div class="ttdeci">size_t write(const uint8_t *buffer, size_t size)</div><div class="ttdoc">Sends specified number of codes to the display.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l01632">terminal.cpp:1632</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_aace245bfe6cab7b4339bd691077e1c23_html_aace245bfe6cab7b4339bd691077e1c23"><div class="ttname"><a href="classfabgl_1_1_terminal_aace245bfe6cab7b4339bd691077e1c23.html#aace245bfe6cab7b4339bd691077e1c23">fabgl::Terminal::enableCursor</a></div><div class="ttdeci">void enableCursor(bool value)</div><div class="ttdoc">Enables or disables cursor.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l00902">terminal.cpp:902</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_aebaecc1fa474fddc48dd5778024b19a5_html_aebaecc1fa474fddc48dd5778024b19a5"><div class="ttname"><a href="classfabgl_1_1_terminal_aebaecc1fa474fddc48dd5778024b19a5.html#aebaecc1fa474fddc48dd5778024b19a5">fabgl::Terminal::begin</a></div><div class="ttdeci">bool begin(BaseDisplayController *displayController, int maxColumns=-1, int maxRows=-1, Keyboard *keyboard=nullptr)</div><div class="ttdoc">Initializes the terminal.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8cpp_source.html#l00307">terminal.cpp:307</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_terminal_html"><div class="ttname"><a href="classfabgl_1_1_terminal.html">fabgl::Terminal</a></div><div class="ttdoc">An ANSI-VT100 compatible display terminal.</div><div class="ttdef"><b>Definition:</b> <a href="terminal_8h_source.html#l00886">terminal.h:886</a></div></div>
<div class="ttc" id="aclassfabgl_1_1_v_g_a16_controller_html"><div class="ttname"><a href="classfabgl_1_1_v_g_a16_controller.html">fabgl::VGA16Controller</a></div><div class="ttdoc">Represents the VGA 16 colors bitmapped controller.</div><div class="ttdef"><b>Definition:</b> <a href="vga16controller_8h_source.html#l00082">vga16controller.h:82</a></div></div>
<div class="ttc" id="afabgl_8h_html"><div class="ttname"><a href="fabgl_8h.html">fabgl.h</a></div><div class="ttdoc">This file is the all in one include file. Application can just include this file to use FabGL library...</div></div>
<div class="ttc" id="afabglconf_8h_a86b59f35df218823a6165d836cfc22c0_html_a86b59f35df218823a6165d836cfc22c0"><div class="ttname"><a href="fabglconf_8h_a86b59f35df218823a6165d836cfc22c0.html#a86b59f35df218823a6165d836cfc22c0">VGA_640x400_70Hz</a></div><div class="ttdeci">#define VGA_640x400_70Hz</div><div class="ttdef"><b>Definition:</b> <a href="fabglconf_8h_source.html#l00240">fabglconf.h:240</a></div></div>
</div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Mon Aug 29 2022 13:52:04 for FabGL by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.3 </li>
  </ul>
</div>
</body>
</html>
